<?

require_once("com/borderwaitmaps/entities/BorderCrossing.php");

class BorderCrossingParser
{

	var $borderCrossing;
	
	function BorderCrossingParser()
	{
		$this->borderCrossing = new BorderCrossing();
	}
	
	function unmarshall($data)
	{
		
		// primitive members
		$this->borderCrossing->setName( $data->name );
		$this->borderCrossing->setCountry( $data->country );
		$this->borderCrossing->setAlternateCrossingName( $data->alternateCrossingName );
		$this->borderCrossing->setHours( $data->hours );
			
		// complex members
		$this->borderCrossing->setLocation( $data->location );
		$this->borderCrossing->setCommercialVehicleFlow( $data->commercialVehicleFlow );
		$this->borderCrossing->setPassengerVehicleFlow( $data->passengerVehicleFlow );
	
	}	
	
	function marshall( $borderCrossing )
	{
		// set up JSON container
		$data;
		$data->class = "BorderCrossing";
		
		// primitive members
		$data->name = $borderCrossing->getName();
		$data->country = $borderCrossing->getCountry();
		$data->alternateCrossingName = $borderCrossing->getAlternateCrossingName();
		$data->hours = $borderCrossing->getHours(); 
		
		// complex members
		$data->location = $borderCrossing->getLocation();
		$data->commercialVehicleFlow = $borderCrossing->getCommercialVehicleFlow();
		$data->passengerVehicleFlow = $borderCrossing->getPassengerVehicleFlow();
		
		return ( $data );
	}	

}
?>